package com.ssy.lingxi.purchase.entity.tender;

import com.fasterxml.jackson.annotation.JsonManagedReference;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * 投标报名实体类
 * @author jw.chen
 * @version 2.0.0
 * @date 2021/3/1
 */
@Getter
@Setter
@Entity
@Table(schema = "public", name = "purchase_submit_tender_register")
public class SubmitTenderRegister implements Serializable {
    private static final long serialVersionUID = -2898004308820633368L;
    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="submit_tender_register_seq")
    @SequenceGenerator(sequenceName="purchase_submit_tender_register_seq", name="submit_tender_register_seq",allocationSize = 1)
    private Long id;

    /**
     * 联系人姓名
     */
    @Column(columnDefinition = "varchar(20)", nullable = false)
    private String name;

    /**
     * 电话区号
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Integer phoneCode;

    /**
     * 联系人电话
     */
    @Column(columnDefinition = "varchar(20)", nullable = false)
    private String phone;
    /**
     * 联系人邮箱
     */
    @Column(columnDefinition = "varchar(20)", nullable = false)
    private String email;

    /**
     * 省级编码
     */
    @Column(columnDefinition = "varchar(10)", nullable = false)
    private String provinceCode;

    /**
     * 省级名称
     */
    @Column(columnDefinition = "varchar(20)", nullable = false)
    private String provinceName;

    /**
     * 市级编码
     */
    @Column(columnDefinition = "varchar(10)", nullable = false)
    private String cityCode;

    /**
     * 市级名称
     */
    @Column(columnDefinition = "varchar(20)", nullable = false)
    private String cityName;

    /**
     * 区级编码
     */
    @Column(columnDefinition = "varchar(10)", nullable = false)
    private String regionCode;

    /**
     * 区级名称
     */
    @Column(columnDefinition = "varchar(20)", nullable = false)
    private String regionName;

    /**
     * 联系人地址
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String address;

    /**
     * 报名要求附件
     */
    @JsonManagedReference
    @OneToMany(mappedBy = "submitTenderRegister", cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
    private List<SubmitTenderRegisterFile> registerFile;

    /**
     * 报名时间
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long createTime = System.currentTimeMillis();

}
